import request from '../utils/request.js'

// 获取订单列表
export function getOrderList(params) {
  return request({
    url: '/order-management/api/orders',
    method: 'get',
    params
  })
}

// 获取订单详情
export function getOrderDetail(orderId) {
  return request({
    url: `/order-management/api/orders/${orderId}`,
    method: 'get'
  })
}

// 创建订单
export function createOrder(data) {
  return request({
    url: '/order-management/api/orders',
    method: 'post',
    data
  })
}

// 更新订单
export function updateOrder(orderId, data) {
  return request({
    url: `/order-management/api/orders/${orderId}`,
    method: 'put',
    data
  })
}

// 删除订单
export function deleteOrder(orderId) {
  return request({
    url: `/order-management/api/orders/${orderId}`,
    method: 'delete'
  })
}

// 提交订单审批
export function submitOrder(orderId) {
  return request({
    url: `/order-management/api/orders/${orderId}/submit`,
    method: 'post'
  })
}

// 取消订单
export function cancelOrder(orderId, reason) {
  return request({
    url: `/order-management/api/orders/${orderId}/cancel`,
    method: 'post',
    params: { reason }
  })
}

// 获取订单统计
export function getOrderStatistics() {
  return request({
    url: '/order-management/api/orders/statistics',
    method: 'get'
  })
}

// 获取订单流程信息
export function getOrderProcess(orderId) {
  return request({
    url: `/order-management/api/orders/${orderId}/process`,
    method: 'get'
  })
}
